package com.service;

import java.util.ArrayList;
import java.util.List;

import org.springframework.web.context.ContextLoader;
import org.springframework.web.context.WebApplicationContext;

import com.dao.FileDaoImpl;
import com.entity.FileEntity;

public class mainpageService {

	public List<FileEntity> getFileEntities() {
		List<FileEntity> fileEntities = new ArrayList<FileEntity>();
		// TODO: 获取所有的文件信息，并赋值给fileEntities
		// Return : fileEntities
		WebApplicationContext ctx=ContextLoader.getCurrentWebApplicationContext();
		//ApplicationContext ctx=new ClassPathXmlApplicationContext("applicationContext.xml");
		FileDaoImpl fileDao = (FileDaoImpl)ctx.getBean("fileDao");
		
		fileEntities=fileDao.findAll(true);
		
		return fileEntities;
	}
}
